﻿using MediatR;
using T.Vehicleservice.API.Application.Command.MaintenanceRecordCommand;
using T.Vehicleservice.Domain.T.MaintenanceRecord.Model;
using T.Vehicleservice.Repository.Interface;

namespace T.Vehicleservice.API.Application.CommandHandlers.MaintenanceRecordCommandHander
{
    /// <summary>
    /// 反填保养信息
    /// </summary>
    public class MaintenanceRecordGetByCommandHandler : IRequestHandler<MaintenanceRecordGetByCommand, MaintenancesRecord>
    {
        private readonly IMaintenanceRecordRepository _maintenanceRecordRepository;
        public MaintenanceRecordGetByCommandHandler(IMaintenanceRecordRepository managementRecordRepository)
        {
            _maintenanceRecordRepository = managementRecordRepository;
        }
        public async Task<MaintenancesRecord> Handle(MaintenanceRecordGetByCommand request, CancellationToken cancellationToken)
        {
            return await _maintenanceRecordRepository.GetModelAsync(request.MaintenanceId);
        }
    }
}
